package pikes.xml;

import java.io.IOException;
import java.io.StringWriter;

import org.junit.Assert;
import org.junit.Test;

import pikes.core.Printable;

public class XMLFilterTestCase {

	@Test
	public void shouldFailWhenCreatingWithNullRootTag() throws Exception {
		XMLFilter filter = new XMLFilter();
		Printable content = new Printable() {

			public void print(Appendable appendable) throws IOException {
				appendable.append('<');

			}

		};
		StringWriter sw = new StringWriter();
		filter.apply(content, sw);
		Assert.assertEquals("<", sw.toString());
	}

	@Test
	public void shouldFailWhenCreatingWithNullRootTag1() throws Exception {
		XMLFilter filter = new XMLFilter();
		Printable content = new Printable() {

			public void print(Appendable appendable) throws IOException {
				appendable.append(" <");

			}

		};
		StringWriter sw = new StringWriter();
		filter.apply(content, sw);
		Assert.assertEquals("<", sw.toString());
	}

}
